Use case: CRC calculation with user configuration ¶
This use case describes how to calculate a CRC with a user configuration using HAL1 and HAL2.
Sequence diagram ¶
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_CRC_Init(&hcrc);
uwCRCValue = HAL_CRC_Calculate(&hcrc,
(uint32_t *)&aDataBuffer,
BUFFER_SIZE);
|
HAL_CRC_Init(&hCRC, HAL_CRC);
HAL_CRC_SetConfig(&hCRC, &crc_config);
HAL_CRC_Calculate(pCRC,
&DataBuffer,
sizeof(uint32_t) * BUFFER_SIZE,
&CrcValue);
|
Key changes ¶
In HAL2, user configuration is applied through
HAL_CRC_SetConfig()before starting the calculation.In HAL2, the CRC APIs can return additional statuses (for example
HAL_INVALID_PARAMandHAL_BUSY).

